import { createApp } from 'vue';
import './style.css';
import App from './App.vue';
import { createRouter, createWebHistory } from 'vue-router';

// 定义路由
const routes = [
    { path: '/', component: () => import('./pages/main.vue') },
    { path: '/:pathMatch(.*)*', redirect: '/' } // 添加默认路由重定向
];

// 创建路由实例并传递 `routes` 配置
const router = createRouter({
    history: createWebHistory(),
    routes
});

// Vuetify
import 'vuetify/styles'
import { createVuetify } from 'vuetify'
import * as components from 'vuetify/components'
import * as directives from 'vuetify/directives'

const vuetify = createVuetify({
    components,
    directives,
  })

// 创建应用实例并挂载
const app = createApp(App);

import "./utils/mathjax";
import "mathjax/es5/tex-svg"; 

// // 引入 `VMdPreview`
// import VMdPreview from '@kangc/v-md-editor/lib/preview';
// import '@kangc/v-md-editor/lib/style/preview.css';
// import githubTheme from '@kangc/v-md-editor/lib/theme/github.js';
// import '@kangc/v-md-editor/lib/theme/style/github.css';

// // 引入 `highlight.js`
// import hljs from 'highlight.js';

// // 配置 `VMdPreview`
// VMdPreview.use(githubTheme, {
//   Hljs: hljs,
// });

// 注册 `VMdPreview`
app.use(router);
app.use(vuetify);
// app.use(VMdPreview);
app.mount('#app');
